package com.ziyear.comsumer.controller;

import com.ziyear.spi.dto.ReqDTO;
import com.ziyear.spi.dto.ResDTO;
import com.ziyear.spi.service.DubboTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    @Autowired
    private DubboTestService dubboTestService;

    @RequestMapping("/sayHello")
    public String sayHello(@RequestParam("username") String username) {
        return dubboTestService.sayHello(username);
    }

    @RequestMapping("/doWork")
    public void doWork(@RequestParam("username") String username) {
        dubboTestService.doWork(username);
    }

    @RequestMapping("/queryUser")
    public ResDTO queryUser(@RequestBody ReqDTO req) {
        return dubboTestService.queryUser(req);
    }
}